package com.sntk.organauthomanager.domain.model;

/**
 * 资源类型
 */
public enum ResourceType {
    PRO("项目", 0), MENU("菜单", 1), BUTTON("按钮", 2), OTHER("其他", 3);

    // 成员变量
    private String name;
    private int index;
    // 构造方法
    private ResourceType(String name, int index) {
        this.name = name;
        this.index = index;
    }

    // 普通方法
    public static ResourceType get(int index) {
        for (ResourceType c : ResourceType.values()) {
            if (c.getIndex() == index) {
                return c;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
